package com.tongji.showroom.service
{
	
	
	import com.tongji.showroom.events.GetSystemSceneEvent;
	
	import flash.system.Security;
	
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.soap.WebService;
	
	import org.robotlegs.mvcs.Actor;
	
	
	/**
	 * 
	 * @author jiarong
	 * 2011-10-31
	 *
	 */
	
	public class GetSystemSceneService extends Actor
	{
		public var ws:WebService;
		
		public function GetSystemSceneService()
		{
			super();
			ws = new WebService();
			ws.wsdl = "http://share.rryjw.com/VRService.asmx?wsdl";
			ws.useProxy = false;
			ws.loadWSDL();
			Security.loadPolicyFile("http://img.rryjw.com/crossdomain.xml");
		}

		public function getAllScene(scjId:String, sfgId:String, currentPage:int, pageSize:int):void
		{
			ws.SearchSystemAllScene(scjId, sfgId, currentPage, pageSize);
			ws.SearchSystemAllScene.addEventListener(ResultEvent.RESULT, getSceneResult);
			ws.SearchSystemAllScene.addEventListener(FaultEvent.FAULT, faultHandler);
		}
		
		private function getSceneResult(event:ResultEvent):void
		{
			dispatch( new GetSystemSceneEvent(GetSystemSceneEvent.UPDATE_ALL_SCENE, null, null, 1, 9, event.result as String));
		}
		
		private function faultHandler(event:FaultEvent):void
		{
			Alert.show("失败" + event.fault.toString());
		}	
	}
}